Hi Everyday |
Re: A Problem In Using Trigger with DXL
Hi Aven_HIT,
string TName = "DialogTrigger"
Trigger T = current
if (null T) { // install code
Trigger installed
// delete an old version of the trigger in the current module
for installed in current Module do
if (name installed == TName) delete installed
// reinstall the trigger
installed = trigger ( TName, module->attribute->all, post, modify, 10, "#include <DialogTrigger.dxl>" )
// check trigger installation
if (null installed) ack "Trigger could not be installed!"
} else {
// Trigger code -> show a dialog
DB c = centered "Triggered Dialog"
label (c, "Please fill in the following attributes")
show c
}
|
Re: A Problem In Using Trigger with DXL
Your post is understandable enough.
Module mod = current
if (null mod) error halt
if (!isEdit(mod)) error halt
string NameTrig = "PopulateB"
string DxlCode = readFile("c:\\MyDxl\\PopulateB.dxl")
string ErrMess = checkDXL(DxlCode)
if (!null ErrMess) print ErrMess
if (confirm("Delete Trig")) delete(NameTrig, attribute->"Attr A", post, save, 5)
if (null ErrMess and
confirm("Deploy Trig")) trigger(NameTrig, attribute->"Attr A", post, save, 5, DxlCode).
Trigger trg = current() if (null trg) error, not running in a trigger AttrDef ad = attrDef(trg) etc.
|
Re: A Problem In Using Trigger with DXL Mathias Mamsch - Sun Nov 29 13:21:08 EST 2009
Hi Aven_HIT,
string TName = "DialogTrigger"
Trigger T = current
if (null T) { // install code
Trigger installed
// delete an old version of the trigger in the current module
for installed in current Module do
if (name installed == TName) delete installed
// reinstall the trigger
installed = trigger ( TName, module->attribute->all, post, modify, 10, "#include <DialogTrigger.dxl>" )
// check trigger installation
if (null installed) ack "Trigger could not be installed!"
} else {
// Trigger code -> show a dialog
DB c = centered "Triggered Dialog"
label (c, "Please fill in the following attributes")
show c
}
I will try your code and your advice at once, Thank you very much. Regards, Aven |
Re: A Problem In Using Trigger with DXL llandale - Mon Nov 30 18:40:03 EST 2009
Your post is understandable enough.
Module mod = current
if (null mod) error halt
if (!isEdit(mod)) error halt
string NameTrig = "PopulateB"
string DxlCode = readFile("c:\\MyDxl\\PopulateB.dxl")
string ErrMess = checkDXL(DxlCode)
if (!null ErrMess) print ErrMess
if (confirm("Delete Trig")) delete(NameTrig, attribute->"Attr A", post, save, 5)
if (null ErrMess and
confirm("Deploy Trig")) trigger(NameTrig, attribute->"Attr A", post, save, 5, DxlCode).
Trigger trg = current() if (null trg) error, not running in a trigger AttrDef ad = attrDef(trg) etc.
When I use the "dynamic" trigger, when "attribute A" of one object changed, thousands of dialog window pop up, and couldn't close them all, this phenomenon abuse me, even after I set up conditions to pop up dialog window, the phenomenon still exists. Hoping to slove this trouble after using "persistent" trigger. Sincerely, Aven |
Re: A Problem In Using Trigger with DXL Aven_HIT - Tue Dec 01 22:23:58 EST 2009 Maybe I didn't describe my problem clearly, I want to pop up a dialog box when I changed one object's attribute. Eager for your help, thank you. Sincerely Aven |
Re: A Problem In Using Trigger with DXL Aven_HIT - Wed Dec 02 03:56:57 EST 2009 sorry for my "ranting" about your post! No hard feelings I hope? :-) Ususally there should be exactly one dialog box for every attribute change, if you use a trigger like this. Even if you change the attribute in your trigger there should be only one dialog box, because while you are in the trigger other triggers are disabled (at least this is my experience I am not 100% sure of this). There might be a a problem with your system, that the change of an attribute will cause the recalculation of a DXL attribute which will again fire the trigger lots of times. But this really depends on your setup and the specific code you are using. If you post your source code we can maybe tell you where the problem is. Best regards, Mathias |
Re: A Problem In Using Trigger with DXL Aven_HIT - Wed Dec 02 03:56:57 EST 2009
You are going to have to post your code.
Trigger trg
bool DumpDxl = confirm("Print DXL of triggers?")
for trg in (current Module) do
{ if (kind(trg) == "builtin") continue
print kind(trg) "\t" stringOf(type(trg)) "\t" stringOf(event(trg)) "\t"
print stringOf(level(trg)) "\t" name(trg) "\n"
if (DumpDxl) print "\t" dxl(trg) "\n\n"
}
|
Re: A Problem In Using Trigger with DXL Mathias Mamsch - Wed Dec 02 16:21:54 EST 2009 As I said, I'm really pleasure to take your advice, and will be more carefully to check my spelling. Really appreciate for your reply, and I will post my code later, very much thanks to you for your attention to my problem. Sincerely, Aven |
Re: A Problem In Using Trigger with DXL llandale - Wed Dec 02 17:21:59 EST 2009
You are going to have to post your code.
Trigger trg
bool DumpDxl = confirm("Print DXL of triggers?")
for trg in (current Module) do
{ if (kind(trg) == "builtin") continue
print kind(trg) "\t" stringOf(type(trg)) "\t" stringOf(event(trg)) "\t"
print stringOf(level(trg)) "\t" name(trg) "\n"
if (DumpDxl) print "\t" dxl(trg) "\n\n"
}
Thanks for your help so kindly. I'll try your code and post my code later. Best wishes, Aven |
Re: A Problem In Using Trigger with DXL Aven_HIT - Tue Dec 01 21:32:53 EST 2009
Maybe I didn't describe my problem clearly, I will interpret it as follows, hope you won't feel boring.
string TName = "ShowDialogBox"
Trigger T = current
if(null T)
{
Trigger installed
for installed in current Module do
if(name installed == TName)
delete installed
installed = trigger(TName, module->attribute->"SpecificAttribute", post, save, 5, "include<ShowDialogBox.dxl>")
if(null installed)
infoBox "Trigger could not be installed"
}
DB showBox = create "Get in the content"
DBE stringIn = field(showBox, "Plese input:", "No. of the days", 20)
void doGetInput(DB showBox){
s = get stringIn
display s
}
void doClearInput(DB showBox){
Set(stringIn, "")
}
apply(showBox, "Get", doGetInput)
apply(showBox, "Clear", doClearInput)
show showBox
|
Re: A Problem In Using Trigger with DXL llandale - Wed Dec 02 17:21:59 EST 2009
You are going to have to post your code.
Trigger trg
bool DumpDxl = confirm("Print DXL of triggers?")
for trg in (current Module) do
{ if (kind(trg) == "builtin") continue
print kind(trg) "\t" stringOf(type(trg)) "\t" stringOf(event(trg)) "\t"
print stringOf(level(trg)) "\t" name(trg) "\n"
if (DumpDxl) print "\t" dxl(trg) "\n\n"
}
I had post my code, it still can't work correctly, hoping for your help and many thanks to you~ Sincerely, Aven |
Re: A Problem In Using Trigger with DXL Mathias Mamsch - Wed Dec 02 16:21:54 EST 2009 I post my code recently, the code still can't work correctly, eagerly for your help with great thanks. Sincerely, Aven |
Re: A Problem In Using Trigger with DXL Aven_HIT - Mon Dec 07 10:23:51 EST 2009
Maybe I didn't describe my problem clearly, I will interpret it as follows, hope you won't feel boring.
string TName = "ShowDialogBox"
Trigger T = current
if(null T)
{
Trigger installed
for installed in current Module do
if(name installed == TName)
delete installed
installed = trigger(TName, module->attribute->"SpecificAttribute", post, save, 5, "include<ShowDialogBox.dxl>")
if(null installed)
infoBox "Trigger could not be installed"
}
DB showBox = create "Get in the content"
DBE stringIn = field(showBox, "Plese input:", "No. of the days", 20)
void doGetInput(DB showBox){
s = get stringIn
display s
}
void doClearInput(DB showBox){
Set(stringIn, "")
}
apply(showBox, "Get", doGetInput)
apply(showBox, "Clear", doClearInput)
show showBox
Your code works, after declaring 'string s' and changing 'Set' to 'set'. the 'display' command appears to do nothing unless it running layout which it isn't.
string DXLCode = "
DB showBox = create \"Get in the content\"
DBE stringIn = field(showBox, \"Plese input:\", \"No. of the days\", 20)
void doGetInput(DB showBox){
string s = get stringIn
display s
}
void doClearInput(DB showBox){
set(stringIn, \"\")
}
apply(showBox, \"Get\", doGetInput)
apply(showBox, \"Clear\", doClearInput)
show showBox
" // end DXLCode
string TName = "ShowDialogBox"
Trigger T = current
if(null T)
{
Trigger installed
for installed in current Module do
if(name installed == TName)
delete installed
if (confirm("Deploy Trigger??"))
{ installed = trigger(TName, module->attribute->"aTest", post, save, 5, DXLCode)
if(null installed)
infoBox "Trigger could not be installed"
}
}
|
Re: A Problem In Using Trigger with DXL Aven_HIT - Mon Dec 07 10:23:51 EST 2009
Maybe I didn't describe my problem clearly, I will interpret it as follows, hope you won't feel boring.
string TName = "ShowDialogBox"
Trigger T = current
if(null T)
{
Trigger installed
for installed in current Module do
if(name installed == TName)
delete installed
installed = trigger(TName, module->attribute->"SpecificAttribute", post, save, 5, "include<ShowDialogBox.dxl>")
if(null installed)
infoBox "Trigger could not be installed"
}
DB showBox = create "Get in the content"
DBE stringIn = field(showBox, "Plese input:", "No. of the days", 20)
void doGetInput(DB showBox){
s = get stringIn
display s
}
void doClearInput(DB showBox){
Set(stringIn, "")
}
apply(showBox, "Get", doGetInput)
apply(showBox, "Clear", doClearInput)
show showBox
don't put the trigger installation code in a DXL layout column! It seems you don't get the concept of trigger right yet. A trigger is a piece of code that DOORS will run, when a specific event happens (like changing an attribute). You install it only once - the trigger installation code you have posted needs to be run only once on the module (over run DXL). Afterwards you can close the module, even close DOORS and when you open the module the trigger will still be there! There seems to be one or two typos in your code. Firstly "include<ShowDialogBox.dxl>" should be "#include <ShowDialogBox.dxl>". And Set(stringIn, "") should be set(stringIn, ""). Otherwise your code looks ok. You have to watch out to have the right include path in your trigger. Try just running "#include <ShowDialogBox.dxl>" in the Run/DXL menu to see that there is no error. Usually the addins path is configured to be "lib/dxl/addins" so you would have to include the file using "#include <user/ShowDialogBox.dxl>". Regards, Mathias |
Re: A Problem In Using Trigger with DXL Mathias Mamsch - Tue Dec 08 02:48:20 EST 2009 An inexperience user using triggers can muck up the Production DOORS installation and affect all users. I think the original poster should be encouraged to set a DOORS installation for test or get one-on-one help. In this case, a consultant would be good -- Kevin can do it. |
Re: A Problem In Using Trigger with DXL llandale - Mon Dec 07 18:27:16 EST 2009
Your code works, after declaring 'string s' and changing 'Set' to 'set'. the 'display' command appears to do nothing unless it running layout which it isn't.
string DXLCode = "
DB showBox = create \"Get in the content\"
DBE stringIn = field(showBox, \"Plese input:\", \"No. of the days\", 20)
void doGetInput(DB showBox){
string s = get stringIn
display s
}
void doClearInput(DB showBox){
set(stringIn, \"\")
}
apply(showBox, \"Get\", doGetInput)
apply(showBox, \"Clear\", doClearInput)
show showBox
" // end DXLCode
string TName = "ShowDialogBox"
Trigger T = current
if(null T)
{
Trigger installed
for installed in current Module do
if(name installed == TName)
delete installed
if (confirm("Deploy Trigger??"))
{ installed = trigger(TName, module->attribute->"aTest", post, save, 5, DXLCode)
if(null installed)
infoBox "Trigger could not be installed"
}
}
First of all, many many thanks for your revising on my code, today, I try it on my PC, they correctly works._
string DXLCode = "
DB showBox = create \"Get in the content\"
DBE stringIn = field(showBox, \"Plese input:\", \"No. of the days\", 20)
void doGetInput(DB showBox){
string s = get stringIn
//display s
//way A
Object o = current //the attribute of ColumB is "string"
o."ColumB" = s //way A will generate a complie error : "badly formed token EOF" on this line
//way B
obj."ColumB" = s //way B will generate the same error as way A
}
void doClearInput(DB showBox){
set(stringIn, \"\")
}
apply(showBox, \"Get\", doGetInput)
apply(showBox, \"Clear\", doClearInput)
show showBox
" // end DXLCode
|
Re: A Problem In Using Trigger with DXL Aven_HIT - Thu Dec 10 07:43:16 EST 2009
First of all, many many thanks for your revising on my code, today, I try it on my PC, they correctly works._
string DXLCode = "
DB showBox = create \"Get in the content\"
DBE stringIn = field(showBox, \"Plese input:\", \"No. of the days\", 20)
void doGetInput(DB showBox){
string s = get stringIn
//display s
//way A
Object o = current //the attribute of ColumB is "string"
o."ColumB" = s //way A will generate a complie error : "badly formed token EOF" on this line
//way B
obj."ColumB" = s //way B will generate the same error as way A
}
void doClearInput(DB showBox){
set(stringIn, \"\")
}
apply(showBox, \"Get\", doGetInput)
apply(showBox, \"Clear\", doClearInput)
show showBox
" // end DXLCode
Hey Aven, o.\"ColumB\" = s instead of o."ColumnB" = s
Object o = current
in a trigger. This works 95% of the time but it will fail in certain situations where the current object is not equal to the object that has been changed. In a trigger to find the object that has changed always use: Trigger T = current Trigger Object o = object T Module m = module T
to get the module or the object that are associated with the trigger event. |
Re: A Problem In Using Trigger with DXL Mathias Mamsch - Thu Dec 10 13:21:07 EST 2009
Hey Aven, o.\"ColumB\" = s instead of o."ColumnB" = s
Object o = current
in a trigger. This works 95% of the time but it will fail in certain situations where the current object is not equal to the object that has been changed. In a trigger to find the object that has changed always use: Trigger T = current Trigger Object o = object T Module m = module T
to get the module or the object that are associated with the trigger event. I'm really fortunate to receive your help in such a short time and I'll try it immediately. At the same time, I'm greatful for you to remind me to avoid the common mistake, thanks~~ Take your advice, and best regards! Sincerely, Aven |
Re: A Problem In Using Trigger with DXL doors36677 - Tue Dec 08 07:45:42 EST 2009 I'm really a beginner in Doors, although playing a role as database manager. One-on-one help seems very amazing, I will consider it later~~ Best regards, Aven |
Re: A Problem In Using Trigger with DXL Mathias Mamsch - Thu Dec 10 13:21:07 EST 2009
Hey Aven, o.\"ColumB\" = s instead of o."ColumnB" = s
Object o = current
in a trigger. This works 95% of the time but it will fail in certain situations where the current object is not equal to the object that has been changed. In a trigger to find the object that has changed always use: Trigger T = current Trigger Object o = object T Module m = module T
to get the module or the object that are associated with the trigger event.
Hey Mathias, o.\"ColumB\" = s
Trigger T = current Trigger Object o = object T o.\"ColumB\" = s
|
Re: A Problem In Using Trigger with DXL Aven_HIT - Fri Dec 11 01:15:09 EST 2009
Hey Mathias, o.\"ColumB\" = s
Trigger T = current Trigger Object o = object T o.\"ColumB\" = s
The problem is probably that the 'Trigger T = current; Object o = object T' is in the callback function of the button. What is probably happening is, that when the trigger is executed your code will execute like this: DB showbox = create (...) ... apply (...) apply (...) show showBox
string code = "
Trigger T = current
if (null T) { print \"No trigger, wtf?\"; halt }
Object o = object T
if (null o) { print \"No object to attribute change, wtf?\"; halt }
DB showBox = create \"Get in the content\"
DBE stringIn = field(showBox, \"Plese input:\", \"No. of the days\", 20)
void doGetInput(DB showBox){
string s = get stringIn
o.\"ColumnB\" = s
// close the dialog box
hide showBox
// make DOORS show the changes to the object
refresh module o
}
void doClearInput(DB showBox){
set(stringIn, \"\")
}
apply(showBox, \"Get\", doGetInput)
apply(showBox, \"Clear\", doClearInput)
show showBox"
Trigger T2
for T2 in current Module do { if (name T2 == "TestTrigger") delete T2 }
print null trigger ("TestTrigger", module->attribute->"Object Text", post, save, 10, code)
|
Re: A Problem In Using Trigger with DXL Mathias Mamsch - Fri Dec 11 07:40:37 EST 2009 The problem is probably that the 'Trigger T = current; Object o = object T' is in the callback function of the button. What is probably happening is, that when the trigger is executed your code will execute like this: DB showbox = create (...) ... apply (...) apply (...) show showBox
string code = "
Trigger T = current
if (null T) { print \"No trigger, wtf?\"; halt }
Object o = object T
if (null o) { print \"No object to attribute change, wtf?\"; halt }
DB showBox = create \"Get in the content\"
DBE stringIn = field(showBox, \"Plese input:\", \"No. of the days\", 20)
void doGetInput(DB showBox){
string s = get stringIn
o.\"ColumnB\" = s
// close the dialog box
hide showBox
// make DOORS show the changes to the object
refresh module o
}
void doClearInput(DB showBox){
set(stringIn, \"\")
}
apply(showBox, \"Get\", doGetInput)
apply(showBox, \"Clear\", doClearInput)
show showBox"
Trigger T2
for T2 in current Module do { if (name T2 == "TestTrigger") delete T2 }
print null trigger ("TestTrigger", module->attribute->"Object Text", post, save, 10, code)
Many thanks to you for your such a long time focus on my problem, I tried your code today, and it meet my application, the code works correctly, many many thanks. Best regards, Aven |
Re: A Problem In Using Trigger with DXL Mathias Mamsch - Fri Dec 11 07:40:37 EST 2009 The problem is probably that the 'Trigger T = current; Object o = object T' is in the callback function of the button. What is probably happening is, that when the trigger is executed your code will execute like this: DB showbox = create (...) ... apply (...) apply (...) show showBox
string code = "
Trigger T = current
if (null T) { print \"No trigger, wtf?\"; halt }
Object o = object T
if (null o) { print \"No object to attribute change, wtf?\"; halt }
DB showBox = create \"Get in the content\"
DBE stringIn = field(showBox, \"Plese input:\", \"No. of the days\", 20)
void doGetInput(DB showBox){
string s = get stringIn
o.\"ColumnB\" = s
// close the dialog box
hide showBox
// make DOORS show the changes to the object
refresh module o
}
void doClearInput(DB showBox){
set(stringIn, \"\")
}
apply(showBox, \"Get\", doGetInput)
apply(showBox, \"Clear\", doClearInput)
show showBox"
Trigger T2
for T2 in current Module do { if (name T2 == "TestTrigger") delete T2 }
print null trigger ("TestTrigger", module->attribute->"Object Text", post, save, 10, code)
My requirement is, if I add a text in "Object Text" column, it should automatically update the data into "ColumnB". Please tell me how to assign a "Object Text" column text changes into "columnB" automatically instead of using "field box" and "Get" button. Looking forward your reply. Thanks in advance, Muthurani M |
Re: A Problem In Using Trigger with DXL muthurani - Thu Jan 07 09:40:18 EST 2010 There is a post recently which is talking about your problem, I remember. Please check it, I am sorry that I couldn't recall its subject clearly. It was posted in recent ten days, maybe hopeful. Best regards, Aven |
Re: A Problem In Using Trigger with DXL Aven_HIT - Mon Jan 11 10:11:23 EST 2010 Thanks for your information.Sorry i couldnt able to find the correct post. I have a question. How to get the value of an object before starting the trigger and also i would like to use the value inside the trigger. Is there anypossible way of doing this. Thanks in advance. Best regards, Muthurani |
Re: A Problem In Using Trigger with DXL muthurani - Tue Jan 19 01:44:43 EST 2010 I'm not following the thread, but a pre-save-attr trigger can get the two values: // code inside pre-save-attr trigger Trigger trg = current Object obj = object(trg) string NameAttr = attrdef(trg) string ValueNominated = value(trg) string ValueCurrent = obj.NameAttr if (ValueNominated is unacceptable) //- then set(TrigPreConFail) else set(TrigPreConPass) Check for nulls before using variables
|